﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:BorderLess"
                    xmlns:ctrl="clr-namespace:BorderLess.Control"
                    xmlns:shell="clr-namespace:Microsoft.Windows.Shell;assembly=Microsoft.Windows.Shell">

    <ControlTemplate x:Key="MainWindowControlTemplate" TargetType="{x:Type local:WindowBorderLess}">
        <Border Background="{DynamicResource MainWindowBackground}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="30" />
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>

                <!-- Captions Buttons to control the window borderless-->
                <ctrl:CaptionButtons Margin="0,0,10,0" Grid.Row="0" HorizontalAlignment="Right" Type="ReduceClose"
                                        Foreground="{DynamicResource CaptionButtonColor}" FontSize="14" MarginButton="0,0,5,0"
                                        VerticalAlignment="Center" shell:WindowChrome.IsHitTestVisibleInChrome="True"/>

                <ContentPresenter Margin="6" Grid.Row="1" Content="{TemplateBinding Content}"/>
            </Grid>
        </Border>
    </ControlTemplate>

    <Style x:Key="MainWindowStyle" TargetType="{x:Type local:WindowBorderLess}">
        <Setter Property="shell:WindowChrome.WindowChrome">
            <Setter.Value>
                <shell:WindowChrome
                        ResizeBorderThickness="6"
                        CaptionHeight="30"
                        CornerRadius="0"
                        GlassFrameThickness="0,0,0,1"/>
            </Setter.Value>
        </Setter>
        <Setter Property="Template" Value="{DynamicResource MainWindowControlTemplate}"/>
    </Style>

</ResourceDictionary>